package com.haiberg.framework.web.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.haiberg.framework.om.Record;
import com.haiberg.framework.services.GenericsClassService;
import com.haiberg.framework.util.Constants;

@Controller
@RequestMapping("/main")
public class MainController {
	@Autowired
	@Qualifier("genericsClassService")
	GenericsClassService<Record> genericsClassService;
	
	@RequestMapping(value="/index")
	public String list(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/index";
	}
	
	@RequestMapping(value="/users")
	public String users(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/users";
	}
	
	@RequestMapping(value="/user")
	public String user(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/user";
	}
	
	@RequestMapping(value="/media")
	public String media(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/media";
	}
	
	@RequestMapping(value="/calendar")
	public String calendar(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/calendar";
	}
	@RequestMapping(value="/privacy-policy")
	public String privacyPolicy(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/privacy-policy";
	}
	@RequestMapping(value="/terms-and-conditions")
	public String termsAndConditions(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/terms-and-conditions";
	}
	@RequestMapping(value="/help")
	public String help(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/help";
	}
	@RequestMapping(value="/faq")
	public String faq(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/faq";
	}
	@RequestMapping(value="/503")
	public String e503(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/503";
	}
	@RequestMapping(value="/403")
	public String e403(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/403";
	}
	@RequestMapping(value="/404")
	public String e404(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/404";
	}
	@RequestMapping(value="/500")
	public String e500(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/500";
	}
	@RequestMapping(value="/reset-password")
	public String resetPassword(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/reset-password";
	}
	@RequestMapping(value="/sign-up")
	public String signUp(Model model,HttpServletRequest request) throws Exception {
		
		
		return "admin/sign-up";
	}
	@RequestMapping(value="/sign-in")
	public String signIn(Model model,HttpServletRequest request) throws Exception {
		
		request.getSession().setAttribute(Constants.USER_INFO_SESSION, new Object());
		return "admin/sign-in";
	}
	@RequestMapping(value="/log-out")
	public String logout(Model model,HttpServletRequest request) throws Exception {
		
		if(request.getSession().getAttribute(Constants.USER_INFO_SESSION) != null)
			request.getSession().removeAttribute(Constants.USER_INFO_SESSION);
		return "admin/sign-in";
	}
	
}
